<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function deepClone(origin, target) {
            var target = target || {},
                toStr = Object.prototype.toString,
                arrStr = "[object Array]"
            for (var prop in origin) {
                if (origin.hasOwnProperty(prop)) {
                    if (origin[prop] !== 'null' && typeof (origin[prop]) == 'object') {
                        if (toStr.call(origin[prop] == arrStr)) {
                            target[prop] = []
                        } else {
                            target[prop] = {}
                        }
                        deepClone(origin[prop], target[prop])
                    } else {
                        target[prop] = origin[prop]
                    }
                }
            }
            return target;
        }

        function deepClone2(origin, target) {
            var target = target || {}
            for (var prop in origin) {
                if (origin.hasOwnProperty(prop)) {
                    if (typeof (origin[prop]) == 'object') {
                        if (Object.prototype.toString.call(origin[prop]) == '[object Array]') {
                            target[prop] = []
                        } else {
                            target[prop] = {}
                        }
                        deepClone2(origin[prop], target[prop])
                    } else {
                        target[prop] = origin[prop]
                    }
                }
            }
        }
    </script>
</body>

</html>